package various;

import java.io.File;

public class Formula {

	public static int getY(int indexValue, int sideValue)
	{
		return indexValue/sideValue;
	}
	public static int getX(int indexValue, int sideValue)
	{
//		return (getY(indexValue,sideValue)*sideValue ) - indexValue ; 
		return indexValue - getY(indexValue,sideValue)*sideValue ; 
	}
	
	public static int getIndex(int x, int y){
		return (x+(y*Constants.vectorSide));
	}
	
	public static int getNbImage(String url)
	{
		int nbImages=0;
		File[] temp = null;
		File dossier = new File(url);
		temp = dossier.listFiles();
	
		for( int i =0; i< temp.length; i ++)
		{
		  if(temp[i].isFile())
			  nbImages++;
		  else getNbImage(temp[i].getPath());
		}
		return nbImages;
	}
	
	public static int getCoordinate(int x){
		return (x/Constants.sizeSquare);
	}
}
